package com.zb.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zb.entity.ZjWithdraw;
import com.zb.extend.WithdrawExtend;
import com.zb.mobile.WithdrawRecordListSearchMobileVo;
import com.zb.vo.WithdrawListSearchVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 提现表 Mapper 接口
 * </p>
 *
 * @author WEN
 * @since 2024-05-27
 */
@Repository
public interface ZjWithdrawMapper extends BaseMapper<ZjWithdraw> {

    /**
     * 获取提现单列表
     * @param custAccId 商家ID
     * @param search 搜索关键词
     * @return
     */
    List<WithdrawExtend> getList(@Param("custAccId") Long custAccId, @Param("search") WithdrawListSearchVo search);
    /**
     * 导出提现单列表
     * @param custAccId 商家ID
     * @param search 搜索关键词
     * @return
     */
    List<WithdrawExtend> getWithdrawOrderList(@Param("custAccId") Long custAccId, @Param("search") WithdrawListSearchVo search);
    /**
     * 获取提现单列表总记录数
     * @param custAccId 商家ID
     * @param search 搜索关键词
     * @return
     */
    long getListCount(@Param("custAccId") Long custAccId, @Param("search") WithdrawListSearchVo search);

    /**
     * 获取提现记录列表
     * @param networkId 服务商ID
     * @param networkEmpId 服务人员ID
     * @param search 搜索对象
     * @return
     */
    List<WithdrawExtend> getWithdrawRecordList(@Param("networkId") Long networkId, @Param("networkEmpId") Long networkEmpId, @Param("search") WithdrawRecordListSearchMobileVo search);

    /**
     * 获取提现记录列表总记录数
     * @param networkId 服务商ID
     * @param networkEmpId 服务人员ID
     * @param search 搜索对象
     * @return
     */
    long getWithdrawRecordListCount(@Param("networkId") Long networkId, @Param("networkEmpId") Long networkEmpId, @Param("search") WithdrawRecordListSearchMobileVo search);

    /**
     * 获取已申请提现未审核的金额
     * @param networkId 服务商ID
     * @param networkEmpId 服务人员ID
     * @return
     */
    BigDecimal getApplyWithdrawMoney(@Param("networkId") Long networkId, @Param("networkEmpId") Long networkEmpId);

    /**
     * 获取已提现的累计金额
     * @param networkId 服务商ID
     * @param networkEmpId 服务人员ID
     * @return
     */
    BigDecimal getTotalWithdrawMoney(@Param("networkId") Long networkId, @Param("networkEmpId") Long networkEmpId);

    /**
     * 根据工单ID获取提现单
     * @param workId 工单ID
     * @return
     */
    ZjWithdraw getByWorkId(@Param("workId") Long workId);
}
